/*
 * oled.h
 *
 *  Created on: May 30, 2021
 *      Author: kirk_
 */

#ifndef OLED_H_
#define OLED_H_

#include "main.h"

#define OLED_I2C_Handle hi2c2


#define OLED_ADDR 0x78U
#define OLED_WRITE 0x78U
#define OLED_READ 0x79U

#define OLED_WIDTH 128U
#define OLED_HEIGHT 64U

void OLED_Init(void);
void OLED_Write_Len(uint8_t reg,uint8_t len,uint8_t *buf);
void OLED_Read_Len(uint8_t reg,uint8_t len,uint8_t *buf);
void OLED_Write_Byte(uint8_t reg, uint8_t data);
void OLED_Write_Display(uint8_t data);
void OLED_Write_Cmd(uint8_t cmd);
uint8_t OLED_Read_Byte(uint8_t reg);

void OLED_Clear(uint8_t mode);
void OLED_Set_Loc(uint8_t x, uint8_t y);

void OLED_Refresh(int start_x, int end_x, int start_y, int end_y);

void OLED_SetPoint(int x, int y);
void OLED_ResetPoint(int x, int y);
void OLED_DrawPoint(int x, int y, uint8_t value);
void OLED_SetPointRefresh(int x, int y);
void OLED_ResetPointRefresh(int x, int y);
void OLED_DrawPointRefresh(int x, int y, uint8_t value);

uint8_t OLED_GetCharWidth(uint8_t height);
void OLED_ShowCharBase(int x, int y, char ch, uint8_t size, uint8_t mode, uint8_t backmode, uint8_t refresh);
void OLED_ShowChar(int x, int y, char ch, uint8_t size);
void OLED_ShowCharRefresh(int x, int y, char ch, uint8_t size);
void OLED_ShowString(int Horizontal, int Vertical, char* String, uint8_t Size, uint8_t Mode);
void OLED_ShowStringRefresh(int Horizontal, int Vertical, char* String, uint8_t Size, uint8_t Mode);
void OLED_ShowNum(int Horizontal, int Vertical, uint32_t Number, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowNumRefresh(int Horizontal, int Vertical, uint32_t Number, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowDec(int Horizontal, int Vertical, uint32_t Dec, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowDecRefresh(int Horizontal, int Vertical, uint32_t Dec, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowSDec(int Horizontal, int Vertical, int32_t SDec, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowSDecRefresh(int Horizontal, int Vertical, int32_t SDec, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowHex(int Horizontal, int Vertical, uint32_t Hex, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowHexRefresh(int Horizontal, int Vertical, uint32_t Hex, uint8_t Length, uint8_t Size, uint8_t Mode);
void OLED_ShowFloat(int Horizontal, int Vertical, double Float, uint8_t Length, uint8_t DeciLength, uint8_t Size, uint8_t Mode);
void OLED_ShowFloatRefresh(int Horizontal, int Vertical, double Float, uint8_t Length, uint8_t DeciLength, uint8_t Size, uint8_t Mode);
void OLED_DrawLine(int HorizontalStart,int HorizonalEnd,int VerticalStart,int VerticalEnd,uint8_t Mode);
void OLED_DrawRectangular(int HorizontalStart,int HorizonalEnd,int VerticalStart,int VerticalEnd,uint8_t Mode);

#endif /* OLED_H_ */
